feat: LHCb modules migration#97
Conversation
|
There is an issue with the FailoverRequest. |
c3f5c70 to
93cb40c
Compare
|
This PR will now tackle the migration of every single module (starting from the ones used in MCSim) by importing LHCb specific functions instead of rewritting them from the ground up |
First approach, needs review
Improve UploadLogFile tests
ca676da to
98ccc37
Compare
6511abe to
1da58a2
Compare
chore: Create proper wf_commons file update
| """Command classes for workflow pre/post-processing operations.""" | ||
|
|
||
| from .analyze_xml_summary import AnalyseXmlSummary | ||
| from .bookkeeping_report import BookeepingReport |
There was a problem hiding this comment.
Oops, missing a k 🙂
| from .bookkeeping_report import BookeepingReport | |
| from .bookkeeping_report import BookkeepingReport |
|
|
||
| dsc = DataStoreClient() | ||
| dsc.addRegister(jobStep) | ||
| workflow_commons["accounting_registers"] = dsc.__registersList |
There was a problem hiding this comment.
I doubt this is going to work as registersList is a private attribute.
I guess you would need to add a public getRegisters() method within LHCbDIRAC no?
| raise | ||
|
|
||
| finally: | ||
| save_workflow_commons(workflow_commons, workflow_commons_path, failed=failed) |
There was a problem hiding this comment.
Any reason for not declaring workflow_commons = {} before the try and keeping save_workflow_commons under the if workflow_commons here? You might get exception because workflow_commons won't be defined I think here. This looks correctly handled in upload_log_file for instance
Same issue in analyze_xml_summary and failover_request and upload_output_data
| from dirac_cwl.core.exceptions import WorkflowProcessingException | ||
|
|
||
|
|
||
| def prepare_lhcb_workflow_commons(workflow_commons_path, extra_mandatory_values=[], extra_default_values={}): |
There was a problem hiding this comment.
I think it's safer to have immutable default arguments:
| def prepare_lhcb_workflow_commons(workflow_commons_path, extra_mandatory_values=[], extra_default_values={}): | |
| def prepare_lhcb_workflow_commons(workflow_commons_path, extra_mandatory_values=None, extra_default_values=None): |
Here you might have some surprises if you end up calling prepare_lhcb_workflow_commons multiple times in a row for any reason. (Just in case if you are not aware: https://florimond.dev/en/posts/2018/08/python-mutable-defaults-are-the-source-of-all-evil)
| finally: | ||
| os.unlink(wf_backup) | ||
|
|
||
| return True |
There was a problem hiding this comment.
Looks like the returned bool is never checked. Is that expected?
|
|
||
| except Exception as e: | ||
| failed = True | ||
| raise WorkflowProcessingException() from e |
| jobStep.setStartTime(now) | ||
| jobStep.setEndTime(now) | ||
|
|
||
| dataDict = { |
| "mcTCK": None, | ||
| "condDB_tag": None, | ||
| "DQ_tag": None, | ||
| "step_status": S_OK(), |
There was a problem hiding this comment.
step_status is either Done or Failed, not S_OK/S_ERROR. Check within the StepAccounting module in LHCbDIRAC
| "step_status": S_OK(), | |
| "step_status": "Done", |
There was a problem hiding this comment.
At some point that should just be a boolean but we cannot change it for now (though you can add a comment for later)
| "inputs", | ||
| "outputs", # outputList | ||
| "executable", | ||
| "command_id", # StepID |
There was a problem hiding this comment.
I am not sure to understand why this is renamed command_id 😅
| from .utils import prepare_lhcb_workflow_commons, save_workflow_commons | ||
|
|
||
|
|
||
| class FailoverRequest(PostProcessCommand): |
There was a problem hiding this comment.
It looks like you are not setting the application status, is that expected? (this can be done through diracX)
See #87
First approach, needs review.
I tried to use the current Mock classes (MockDataManager), but I don't think this is the correct way. However, it should not vary much.
I open it as a draft because I still need to create 2 more tests and change the interactions with DIRAC.